how to use restful api in python